package cm.config;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @author: yxh
 * @Description: 过滤MyBatisPlus分页参数
 * @Date: Created in 2024/12/26 09:41
 * @Modified By: 添加到相应Long 类型 @JsonSerialize(using = LongJsonSerializer.class)
 */
@Configuration
public class LongJsonSerializer extends JsonSerializer<Long> {
    @Override
    public void serialize(Long value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
            throws IOException {
        if (value != null) {
            jsonGenerator.writeNumber(value);
        }
    }
}
